//
//  PKPlayInfoView.m
//  PianKe
//
//  Created by lanou on 15/10/8.
//  Copyright (c) 2015年 李伟伟. All rights reserved.
//

#import "PKPlayInfoView.h"
#import "PKCollectionViewCell.h"
@interface PKPlayInfoView()<UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,UICollectionViewDataSource>
@end

@implementation PKPlayInfoView


- (void)awakeFromNib
{
    [_collectionView registerClass:[PKCollectionViewCell class] forCellWithReuseIdentifier:@"reUseCell"];
    _collectionView.dataSource = self;
    _collectionView.delegate = self;
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return _imageArray.count;
}


//自定义Cell-----------------------------
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    PKCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"reUseCell" forIndexPath:indexPath];
    
    [cell.picImageView sd_setImageWithURL:[NSURL URLWithString:_imageArray[indexPath.item]]];
    
    
    return cell;
}



-(void)configurePlayInfoData:(PKRadioDetailModel *)model
{
    _authorNamelabel.text = model.playInfo.authorinfo[@"uname"];
    _userNameLabel.text = model.playInfo.userinfo[@"uname"];
    _radioNameLabel.text = model.title;
    [_userImageView sd_setImageWithURL:[NSURL URLWithString:model.playInfo.userinfo[@"icon"]]];
    [_authorImageView sd_setImageWithURL:[NSURL URLWithString:model.playInfo.authorinfo[@"icon"]]];
    
    _userImageView.layer.cornerRadius = 15;//数字等于frame的一半，圆角幅度就会变成圆形
    _userImageView.layer.masksToBounds = YES;// 图片加载到imageView上后也变成圆角
    _userImageView.contentMode = UIViewContentModeScaleAspectFit;//图片大小自适应imageView的大小
    
    _authorImageView.layer.cornerRadius = 15;
    _authorImageView.layer.masksToBounds = YES;
    _userImageView.contentMode = UIViewContentModeScaleAspectFit;
    
    

    
}




@end
